import { defineStore } from 'pinia';
import { ref } from 'vue'

export const useMemberStore = defineStore('member', () => {

	const profile = ref<any>()

	// 获取用户信息
	const setProfile = (val : any) => {
		profile.value = val
	}
	// 清空用户信息
	const clearProfile = () => {
		profile.value = undefined
	}

	return { profile, setProfile, clearProfile };
},
	// 持久化
	{
		persist: {
			storage: {
				setItem(key, value) {
					uni.setStorageSync(key, value)
				},
				getItem(key) {
					return uni.getStorageSync(key)
				}
			}
		}
	}
);